package models;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.OneToMany;

import play.data.validation.MaxSize;
import play.db.jpa.Model;

/**
 * @author Emaleu KAMGA
 * 
 * Une classe pour le modele de la ville
 */

@Entity
public class City  extends Model{

	public String name;
	@Lob
    @MaxSize(10000)
	public String description;
	public String longitude;
	public String latitude;
	
	@OneToMany(mappedBy="city", cascade=CascadeType.ALL)
	public List<ToursicItem> touristicItems;
	
	public City(String name, String description, String longitude, String latitude){
		this.touristicItems = new ArrayList<ToursicItem>();
		this.name = name;
		this.description = description;
		this.longitude = longitude;
		this.latitude = latitude;
	}
	
	@Override
	public String toString() {
	    return name;
	}
	
}
